<template>
  <el-dialog
    title="关闭案件"
    :visible.sync="visible"
    :modal="false"
    :close-on-click-modal="false"
    :modal-append-to-body="false"
    width="40%"
  >
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="关闭原因">
        <el-input type="textarea" v-model="form.desc"></el-input>
      </el-form-item>

      <el-form-item>
        <el-button size="small" @click="cancel">取消</el-button>
        <el-button type="primary" size="small" @click="submit">关闭</el-button>
      </el-form-item>
    </el-form>
  </el-dialog>
</template>
<script>
import { closeCases } from '@/api/risksystem/riskWarning/caseManagement/index'
export default {
  props: [],
  data() {
    return {
      // 要提交的参数
      item: {},
      form: {},

      // 菜单表单
      loading: false,
      visible: false,
      submiting: false
    }
  },
  methods: {
    show(row) {
      this.form = {}
      this.visible = true
      this.item = row
      console.log(row)
    },
    submit() {
      this.form.id = this.item.id
      console.log(this.form)
      closeCases(this.form).then(response => {
        console.log(response)
        if (response.code === 0) {
          this.visible = false
          this.$emit('close')
        } else {
          console.log(response)
          this.$message.error(response.msg)
        }
      })
      // .catch(error => {
      //   this.$message.error(error)
      // })
    },
    cancel() {
      this.visible = false
    }
  }
}
</script>
<style lang="postcss" scoped>
.el-form-item {
  margin-bottom: 5px;
}
</style>
